home *** CD-ROM | disk | FTP | other *** search
- #!/bin/sh
- #
- # ShowMe TV startup script.
- #
- # @(#)showmetv.sh 1.11 96/02/26 Copyright 1993-96 Sun Microsystems, Inc. All Rights Reserved.
- #
-
-
- #
- # Where various components of this application live.
- #
- ShowMeHome=
- showmeHome=
- utilsHome=
- helpHome=
- motifHome=
-
- helpExecDir=
- showmeExecDir=
- machDepExecDir=
-
- osVersion=
-
-
- programName=$0
-
-
- #
- # If a path name is a symbolic link, resolve it.
- #
- GetRealPath()
- {
- pathName="$1"
- level=1
-
-
- while [ -h "$pathName" ] ; do
-
- level=`/bin/expr $level + 1`
- if [ $level -gt 10 ] ; then
- echo "$pathName: too many levels of symbolic links"
- break;
- fi
-
- #
- # First, make sure we have an absolute path name.
- #
- if IsRelativePath "$pathName" ; then
- pathName=`/bin/pwd`/"$pathName"
- fi
-
- #
- # Then determine where the link points (via "ls -l")
- #
- dirName=`/bin/dirname $pathName`
- link=`/bin/ls -l $pathName | sed -e 's,.* -> ,,g'`
-
- if IsRelativePath "$link" ; then
- pathName="$dirName"/"$link"
- else
- pathName="$link"
- fi
- done
-
- echo "$pathName"
-
- return 0
- }
-
-
- #
- # Is this a relative path name (i.e., doesn't begin with "/")?
- #
- IsRelativePath()
- {
- pathName="$1"
-
- if [ `echo "$pathName" | sed -e 's,^/.*,absolute,g'` = "absolute" ] ; then
- return 1
- else
- return 0
- fi
- }
-
-
- #
- # Determine what version of Solaris we're running
- #
- GetOSVersion()
- {
- OS=`/bin/uname -r`
-
- case $OS in
- 4.*) osVersion=SUNOS;;
- 5.*) case `/bin/uname -p` in
- sparc)
- osVersion=SVR4;;
- *86)
- osVersion=I386;;
- esac;;
- A.*)
- osVersion=HPUX;;
- esac
-
- }
-
-
- #
- # Determine where ShowMe TV lives.
- # We assume that it's two levels up above the directory containing
- # this script.
- #
- GetPaths()
- {
- tmpDir=`GetRealPath $programName`
- tmpDir=`dirname $tmpDir`
- ShowMeHome=`( cd $tmpDir/../.. && /bin/pwd )`
-
- showmeHome=$ShowMeHome/ShowMeTV
- utilsHome=$ShowMeHome/utilities
- helpHome=$ShowMeHome/help
- # motifHome=$ShowMeHome/motif
- motifHome=/usr/dt/lib
- }
-
-
- #
- # Set up ShowMe TV environment.
- #
- SetupEnvironment()
- {
- helpExecDir=$helpHome/bin
- HHPATH=$showmeHome/share ; export HHPATH
-
- showmeExecDir=$showmeHome/bin
- machDepExecDir=$showmeExecDir/bin-$osVersion
- utilsBinDir=$utilsHome/bin
- utilsExecDir=$utilsHome/bin/bin-$osVersion
- sunsolBinDir=`dirname $0`
-
-
- #
- # Add ShowMe TV and HyperHelp executable directories to shell search path
- #
- PATH=${showmeExecDir}:${machDepExecDir}:${utilsBinDir}:${utilsExecDir}:${helpExecDir}:${sunsolBinDir}:${PATH}
-
- export PATH
-
- #
- # Use our own Motif key_bindings because the built-in ones
- # in the Motif library don't handle all the Sun keys correctly.
- # However, if XMBINDDIR is already set, leave it alone!
- #
-
- if [ -d ${motifHome}/share/key_bindings ]; then
- XMBINDDIR=${XMBINDDIR:=${motifHome}/share/key_bindings}
- export XMBINDDIR
- fi
-
- #
- # Needed for demo license.
- #
- SUNSOL_HOME=${ShowMeHome} ; export SUNSOL_HOME
- }
-
- #
- # Make sure system has SUNWmfrun installed
- #
- CheckMotifPath()
- {
- [ -d $motifHome ] || {
-
- # OK, /usr/dt/lib isn't there, but maybe it is installed
- # elsewhere and LD_LIBRARY_PATH is set. Run this ldd
- # on the binary to see if libXm is really not found.
- ldd $machDepExecDir/`basename $0` | fgrep "libXm" | fgrep "not found" > /dev/null 2>&1
-
- # If the grep matched then we matched "libXm" and "not found"
- if [ $? = 0 ]
- then
- echo "`basename $0`: $motifHome not found"
- echo "\tPlease install the SUNWmfrun (Motif RunTime Kit) package."
- echo "\tThis package is bundled with Solaris 2.4 and above. If you"
- echo "\tare running Solaris 2.3 you should install the 2.4 package"
- echo "\tthat is included on the ShowMe TV 1.1 installation media."
- echo "\tExiting `basename $0`"
- exit 1
- fi
- }
- }
-
- #
- # Update loader search path as necessary.
- #
- SetLibraryPath()
- {
- motifLibDir=$motifHome/lib-$osVersion
-
-
- [ -d $motifLibDir ] || {
- echo "Sorry, can't run `basename $0` - the Motif shared library is missing."
- exit 1
- }
-
- #
- # Setup Motif environment variables for SUNOS
- #
- if [ $osVersion = "SUNOS" ] ; then
- XLIBDIR=$motifLibDir
- export XLIBDIR
- XLIBI18N_PATH=$motifLibDir/X11
- export XLIBI18N_PATH
- XKEYSYMDB=$motifLibDir/X11/XKeysymDB
- export XKEYSYMDB
- fi
-
- # On 4.x systems, we are required to set LD_LIBRARY_PATH
- # On 5.2 and 5.3 systems, we must set it to pick up the patched libXt
-
- #
- # Prepend the ShowMe TV specific X and Motif library directory,
- # followed by the regular Sun OpenWindow library directory.
- #
- openwinHome=${OPENWINHOME:-/usr/openwin}
-
- case $OS in
- 4.*)
- LD_LIBRARY_PATH=${motifLibDir}:${openwinHome}/lib:${LD_LIBRARY_PATH};;
- 5.[23])
- LD_LIBRARY_PATH=${motifLibDir}:${motifLibDir}/patched-libs,5.2:${openwinHome}/lib:${LD_LIBRARY_PATH};;
- *)
- LD_LIBRARY_PATH=${motifLibDir}:${openwinHome}/lib:${LD_LIBRARY_PATH};;
- esac
-
- export LD_LIBRARY_PATH
- }
-
-
- ####################################################
-
- GetOSVersion
-
- GetPaths
-
- SetupEnvironment
-
- case `basename $0` in
- splitmov | mergemov | catmov)
- # Don't need motif
- ;;
- showmetv | showmetvt | showmetvd)
- # Need motif. Make sure it is installed
- CheckMotifPath
-
- # Old stuff for SUNWsunsol/motif. May need later for 4.x support
- # SetLibraryPath
- #
- # # Cleanup Motif key bindings
- # if [ -x ${motifHome}/lib-${osVersion}/bin/delbind_util ]; then
- # ${motifHome}/lib-${osVersion}/bin/delbind_util $*
- # fi
- ;;
- esac
-
- case `basename $0` in
- showmetv)
- echo "Starting ShowMe TV 1.1"
- ;;
- showmetvt)
- echo "Starting ShowMe Transmitter 1.1"
- ;;
- splitmov)
- ;;
- showmetvd)
- ;;
- esac
-
- exec $machDepExecDir/`basename $0` $@
-
- exit 0
-